package com.hsogoo.ultraman;

import com.hsogoo.ultraman.monitor.ZkClient;
import com.hsogoo.ultraman.util.AppendUtil;

public class ZkTest {

    public static void main(String[] args) throws Exception{
//        String localIp = NetworkUtil.getLocalIpString();
//        String serverPort = "9823";
//        String path = AppendUtil.appendString(Constant.CONFIG_SERVER_LIST, Constant.PATH_PREFIX,
//                localIp, Constant.IP_PORT_SEPARATOR, serverPort);
        ZkClient zkClient = ZkClient.getInstance("localhost:2181");
//        if (zkClient != null) {
//            try{
//                zkClient.createNode(path, CreateMode.EPHEMERAL);
//            }catch (Exception ex){
//            }
//        }
        String path = AppendUtil.appendString(Constant.CONFIG_PUBLISH_NODE, Constant.PATH_PREFIX,
        "dev", Constant.PATH_PREFIX, "trade",Constant.PATH_PREFIX, "app");
        zkClient.write(path, "1");
        Thread.sleep(Integer.MAX_VALUE);
    }
}
